package com.bw.zh32301.fg

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.bw.base.mvvm.BaseFragment
import com.bw.zh32301.R
import com.bw.zh32301.databinding.FragmentHomeBinding
import com.bw.zh32301.spq.AnnounceSPQ
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class HomeFragment : BaseFragment<FragmentHomeBinding,HomeViewModel>() {
    lateinit var announceSPQ: AnnounceSPQ
    override fun initView() {
        viewModel.announce(0,10)
        announceSPQ= AnnounceSPQ()
        binding.rv.adapter=announceSPQ
        binding.rv.layoutManager=LinearLayoutManager(activity)
    }

    override fun initData() {
        viewModel.announceLiveData.observe(this){
            announceSPQ.data.clear()
            announceSPQ.data.addAll(it)
            announceSPQ.notifyDataSetChanged()
        }
    }
}